// 通用js公共方法
import React, {Component} from 'react';
import API from './API';

export default class CommonUtils extends Component {
  //二级菜单授权
  static getUserTabs(tabs){
    let rsTabs = [];
    //获取二级菜单
    const menus = API.getUserMenu({type:2});
    let labels = [];
    menus.result.forEach((item)=>{
      if(item.label != undefined) labels.push(item.label);
    })
    //循环认证数据
    tabs.forEach((item)=>{
      if (labels.find((i)=> i==item.key) != undefined) {
        rsTabs.push(item)
      }
    });
    return rsTabs;
  }
}
